package com.cike.sparkstudy.basescala

import scala.collection.mutable.ArrayBuffer

object ArrayTest {
  def main(args: Array[String]): Unit = {
    val arr = new Array[Int](10);
    arr(0) = 1
    for(i <- 0 until arr.length){
      print(arr(i))
    }
    print("=-===============================")
    print(arr.mkString(", "))
    arrayBuffer()

    tupeTest();
  }


  def arrayBuffer(): Unit ={
    val arrbuffer = ArrayBuffer[String]()
    arrbuffer += "leolei"
    arrbuffer += ("lei","test","spark")
    arrbuffer.insert(1,"Insert")
    print(arrbuffer.toString())
  }
  def arrayBuffer2():Unit= {

  }

  def tupeTest():Unit={
    val names = Array("leo", "jack", "mike")
    val ages = Array(30, 24, 26)
    val nameAges = names.zip(ages)
    for ((name, age) <- nameAges) println(name + ": " + age)
  }



}
